package com.aiyun.rabbit.rabbitdemo.config;


import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.HeadersExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class OrderProcessFailureConfiguration {

	@Bean
	public FanoutExchange orderFailureExchange(){
		return new FanoutExchange("exchange.order.process.failure");
	}

	@Bean
	public Queue orderFailureQueue(){
		return new Queue("queue.order.process.failure");
	}

	@Bean
	public Queue stockFailureQueue(){
		return new Queue("queue.stock.process.failure");
	}

	@Bean
	public Binding bindingStockFailure(){
		return BindingBuilder.bind(stockFailureQueue()).to(orderFailureExchange());
	}

	@Bean
	public HeadersExchange headersExchange(){
		return new HeadersExchange("header");
	}
}
